#include "widget.h"
#include "ui_widget.h"
#include <QStringList>

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);

    //进行下拉菜单的设置
    QStringList list1 = {"香辣鸡腿堡", "巨无霸", "双层牛肉堡"};
    ui->comboBox->addItems(list1);

    QStringList list2 = {"薯条", "鸡块", "鸡翅"};
    ui->comboBox_2->addItems(list2);

    QStringList list3 = {"雪碧", "可乐"};
    ui->comboBox_3->addItems(list3);

    //对QSpinBox进行范围设置
    ui->spinBox->setRange(1, 5);
    ui->spinBox_2->setRange(1, 5);
    ui->spinBox_3->setRange(4, 5);

    ui->spinBox->setValue(1);
    ui->spinBox_2->setValue(2);
    //这里很奇怪,明明设置4~5,但是用户还是可以输入1,2,3
    ui->spinBox_3->setValue(2);
}

Widget::~Widget()
{
    delete ui;
}

